﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Moving03.Administrator
{
    public partial class WebForm14 : System.Web.UI.Page
    {
        DataClasses1DataContext context = new DataClasses1DataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated == false || User.Identity.IsAuthenticated == true && !User.IsInRole("Admin"))
            {
                Response.Redirect("../Login.aspx");
            }
            if (!IsPostBack)
            {

                DropDownList3.DataBind();
                DropDownList4.DataBind();
                DropDownList3.Items.Insert(0, "Chọn Quốc Gia");
                DropDownList4.Items.Insert(0, "Chọn Quốc Gia");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            int maquocgia1 = int.Parse(DropDownList3.SelectedValue);
            int maquocgia2 = int.Parse(DropDownList4.SelectedValue);
          
           
            int ngaychuyenbt = int.Parse(txtNgayThuong.Text);
            int ngaychuyenn = int.Parse(txtNgayNhanh.Text);

            ChiPhiDiaDiemNuocNgoai cpnn = new ChiPhiDiaDiemNuocNgoai();
            cpnn.Id_QuocGia1 = maquocgia1;
            cpnn.Id_QuocGia2 = maquocgia2;
           
            cpnn.NgayGoiHangBinhThuong = ngaychuyenbt;
            cpnn.NgayGoiHangNhanh = ngaychuyenn;

            context.ChiPhiDiaDiemNuocNgoais.InsertOnSubmit(cpnn);
            context.SubmitChanges();
            Response.Redirect("QuanLyChiPhi.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("QuanLyChiPhi.aspx");
        }

    }
}